import { ResPage, User } from "@/api/interface/index";
import http from "@/api";

/**
 * @name 角色管理模块
 */
// 获取角色列表
export const getRoleList = (params: any) => {
  return http.post<any>('/roleManage/roleList', params);
};

//获取菜单信息
export const getMenuList = (): Promise<any> => {
  return http.get<any>('/roleManage/getAllMenuData');
};

//获取全部角色
export const getAllRoleList = (): Promise<any> => {
  const headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };
  return http.get<any>('/roleManage/listOfRoles', {}, { headers });
};

//新增角色
export const newRole = (params: any): Promise<any> => {
  return http.post<any>('/roleManage/addRole', params);
};

//编辑角色
export const editRole = (params: any): Promise<any> => {
  return http.post<any>('/roleManage/editRole', params);
};

//删除角色
export const deleteTheRole = (params: any): Promise<any> => {
  const headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };
  return http.delete<any>(`/roleManage/deleteRole/${params}`, {}, { headers });
};

//根据角色Id查询角色信息
export const queryRoleInfoById = (params: any): Promise<any> => {
  const headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };
  return http.get<any>(`/roleManage/userInformationBasedOnRoleId/${params}`, {}, { headers });
};

//根据角色id获取角色人员列表
export const getRoleUserList = (params: any): Promise<any> => {
  return http.post<any>(`roleManage/userList`, params);
};
